/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package etherblocks.mods.survival.entitysystem.components;

import com.jme3.network.serializing.Serializable;

/**
 *
 * @author Philipp
 */
@Serializable
public class HungerComponent {
    private float hunger;
    private float maxHunger;
    private float regeneration;

    public HungerComponent() {
    }

    public HungerComponent(float hunger, float maxHunger, float regeneration) {
        if(hunger > maxHunger) {
            this.hunger = maxHunger;
        }
        else if(hunger < 0)
        {
            this.hunger = 0;
        }
        else
        {
            this.hunger = hunger;
        }
        this.maxHunger = maxHunger;
        this.regeneration = regeneration;
    }

    public float getHunger() {
        return hunger;
    }

    public float getMaxHunger() {
        return maxHunger;
    }

    public float getRegeneration() {
        return regeneration;
    }
    
    public float getHungerProportion()
    {
        return hunger / maxHunger;
    }
}
